home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 22 / Amiga Format AFCD22 (Jan 1998, Issue 106).iso / -seriously_amiga- / shareware / programming / other / pmdev / include / libraries / pm.h
C/C++ Source or Header  |  1997-11-17  |  8KB  |  221 lines

  1. //
  2. //    $VER: pm.h 6.0 (23.9.97)
  3. //
  4. //    Library base, tags and macro definitions
  5. //    for popupmenu.library.
  6. //
  7. //    ©1996-1997 Henrik Isaksson
  8. //    All Rights Reserved.
  9. //
  10.  
  11. #ifndef LIBRARIES_POPUPMENU_H
  12. #define LIBRARIES_POPUPMENU_H
  13.  
  14. #ifndef EXEC_TYPES_H
  15. #include <exec/types.h>
  16. #endif
  17.  
  18. #ifndef EXEC_LIBRARIES_H
  19. #include <exec/libraries.h>
  20. #endif
  21.  
  22. #ifndef UTILITY_TAGITEM_H
  23. #include <utility/tagitem.h>
  24. #endif
  25.  
  26. //
  27. // Tags passed to PM_OpenPopupMenuA and PM_FilterIMsgA
  28. //
  29.  
  30. #define PM_Menu            (TAG_USER+4)    // (struct PopupMenu *) Pointer to menulist initialized by MakeMenu()
  31. #define PM_Top            (TAG_USER+12)    // (LONG) Top (Y) position
  32. #define PM_Left            (TAG_USER+13)    // (LONG) Left (X) position
  33. #define PM_Code            (TAG_USER+14)    // (UWORD) Read the documentation.
  34. //#define PM_Right        (TAG_USER+15)
  35. //#define PM_Bottom        (TAG_USER+16)
  36. //#define PM_MinWidth        (TAG_USER+17)
  37. //#define PM_MinHeight        (TAG_USER+18)
  38. //#define PM_ForceFont        (TAG_USER+19)
  39. #define PM_PullDown        (TAG_USER+90)    // (BOOL) Make the menu a pulldown menu.
  40. #define PM_MenuHandler        (TAG_USER+91)    // (struct Hook *) Hook that is called for each selected item, after the
  41.                         // menu has been closed. This tag turns on MultiSelect.
  42. #define PM_AutoPullDown        (TAG_USER+92)    // Make an automatic pulldown menu. (PM_FilterIMsg only)
  43.  
  44. //
  45. // Tags passed to MakeItem
  46. //
  47.  
  48. #define PM_Title        (TAG_USER+20)    // Item title
  49. #define PM_UserData        (TAG_USER+21)    // Anything, returned by OpenPopupMenu when this item is selected
  50. #define PM_ID            (TAG_USER+22)    // ID number, if you want to access this item later
  51. #define PM_Sub            (TAG_USER+23)    // Pointer to submenu list (from MakeMenu)
  52. #define PM_Flags        (TAG_USER+24)    // For internal use
  53. #define PM_NoSelect        (TAG_USER+25)    // Make the item unselectable
  54. #define PM_FillPen        (TAG_USER+26)    // Make the item appear in FILLPEN
  55. #define PM_Checkit        (TAG_USER+27)    // Leave space for a checkmark
  56. #define PM_Checked        (TAG_USER+28)    // Make this item is checked
  57. #define PM_Italic        (TAG_USER+29)    // Italic text
  58. #define PM_Bold            (TAG_USER+30)    // Bold text
  59. #define PM_Underlined        (TAG_USER+31)    // Underlined text
  60. #define PM_TitleBar        (TAG_USER+32)    // Horizontal separator bar
  61. #define PM_WideTitleBar        (TAG_USER+33)    // Same as above, but full width
  62. #define PM_ShadowPen        (TAG_USER+34)    // Draw text in SHADOWPEN
  63. #define PM_ShinePen        (TAG_USER+35)    // Draw text in SHINEPEN
  64. #define PM_Center        (TAG_USER+36)    // Center the text of this item
  65. #define PM_Exclude        (TAG_USER+37)    // Items to unselect (or select) when this gets selected
  66. #define PM_Disabled        (TAG_USER+38)    // Disable an item
  67. #define PM_ImageSelected    (TAG_USER+39)    // Image when selected, PM_Title will be render on top of the image
  68. #define PM_ImageUnselected    (TAG_USER+40)    // Image when unselected
  69. #define PM_IconSelected        (TAG_USER+41)    // Icon when selected
  70. #define PM_IconUnselected    (TAG_USER+42)    // Icon when unselected
  71. //#define PM_ImageMode        (TAG_USER+43)
  72. #define PM_AutoStore        (TAG_USER+44)    // Pointer to BOOL reflecting the current state of the item
  73. #define PM_TextPen        (TAG_USER+45)    // Pen number for text colour of this item, if you want to allocate a pen yourself
  74. //#define PM_            (TAG_USER+46)
  75. #define PM_CommKey        (TAG_USER+47)    // Keyboard shortcut for this item.
  76. #define PM_Shadowed        (TAG_USER+48)    // Gives the text a shadow
  77.  
  78. //
  79. // Tags passed to MakeMenu
  80. //
  81.  
  82. #define PM_Item            (TAG_USER+50)    // Item pointer from MakeItem
  83. #define PM_Dummy        (TAG_USER+51)    // Sometimes very useful
  84.  
  85. //
  86. // Tags passed to MakeIDList
  87. //
  88.  
  89. #define PM_ExcludeID        (TAG_USER+55)    // ID number of menu to deselect when this gets selected
  90. #define PM_IncludeID        (TAG_USER+56)    // ID number of menu to select when this gets selected
  91. #define PM_ReflectID        (TAG_USER+57)    // ID number of menu that should reflect the state of this one
  92. #define PM_InverseID        (TAG_USER+58)    // ID number of menu to inverse reflect the state of this one
  93.  
  94. //
  95. // PM_AlterState "action" values
  96. //
  97.  
  98. #define    PMACT_DESELECT        2    // Deselect the item
  99. #define PMACT_SELECT        3    // Select the item
  100.  
  101. //
  102. // Macros
  103. //
  104.  
  105. #define PMMenu(t)    PM_MakeMenu(PM_Item, PM_MakeItem(PM_Title, t, PM_NoSelect, TRUE, PM_ShinePen, TRUE, PM_Shadowed, TRUE, PM_Center, TRUE, TAG_DONE),\
  106.             PM_Item, PM_MakeItem(PM_WideTitleBar, TRUE, TAG_DONE)
  107. #define PMSimpleSub    PM_Sub, PM_MakeMenu(PM_Dummy, 0
  108. #define PMSubMenu(t)    PM_Sub, PM_MakeMenu(PM_Item, PM_MakeItem(PM_Title, t, PM_NoSelect, TRUE, PM_ShinePen, TRUE, TAG_DONE),\
  109.             PM_Item, PM_MakeItem(PM_WideTitleBar, TRUE, TAG_DONE)
  110. #define PMItem(t)    PM_Item, PM_MakeItem(PM_Title, t
  111. #define PMInfo(t)    PM_Item, PM_MakeItem(PM_Title, t, PM_NoSelect, TRUE, PM_ShinePen, TRUE
  112. #define PMBar        PM_Item, PM_MakeItem(PM_TitleBar, TRUE
  113. #define PMTitleBar    PMBar
  114. #define PMMenuTitle(t)    PM_Item, PM_MakeItem(PM_Title, t, PM_NoSelect, TRUE, PM_ShinePen, TRUE, PM_Shadowed, TRUE, PM_Center, TRUE, TAG_DONE),\
  115.             PM_Item, PM_MakeItem(PM_WideTitleBar, TRUE, TAG_DONE)
  116. #define PMExcl        PM_Exclude, PM_MakeIDList(
  117. #define ExID(id)    PM_ExcludeID, id
  118. #define InID(id)    PM_IncludeID, id
  119. #define RefID(id)    PM_ReflectID, id
  120. #define InvID(id)    PM_InverseID, id
  121. #define PMCheckItem(t,id)    PM_Item, PM_MakeItem(PM_Title, t, PM_ID, id, PM_Checkit, TRUE
  122.  
  123. #define PMEnd        TAG_DONE)
  124.  
  125. #ifndef End
  126. #define End        TAG_DONE)
  127. #endif
  128.  
  129. #define PMERR        (-5L)
  130.  
  131. //
  132. // Library base
  133. //
  134.  
  135. struct PopupMenuBase {
  136.     struct Library        pmb_Library;
  137.     ULONG            pmb_SegList;
  138.     ULONG            pmb_Flags;
  139.     struct Library        *pmb_ExecBase;
  140.     struct Library        *pmb_UtilityBase;
  141.     struct Library        *pmb_IntuitionBase;
  142.     struct Library        *pmb_GfxBase;
  143.     struct Library        *pmb_DOSBase;
  144.     BOOL            pmb_NewPrefs;
  145.     struct Library        *pmb_CxBase;
  146. };
  147.  
  148. #define POPUPMENU_VERSION    6L
  149. #define POPUPMENU_NAME        "popupmenu.library"
  150.  
  151. //
  152. // PopupMenu structure
  153. //
  154.  
  155. #ifndef PMPRIV_H
  156.  
  157. struct PopupMenu {
  158.     struct PopupMenu    *Next;
  159.     struct PopupMenu    *Sub;
  160.     STRPTR            Title;        // Title
  161.     ULONG            Flags;
  162.     ULONG            ID;        // Item ID
  163.     APTR            UserData;    // UserData
  164.  
  165.     // The rest of the structure is private, at least for now!
  166. };
  167.  
  168. #endif
  169.  
  170. //
  171. // Obsolete stuff follows....
  172. //
  173.  
  174. #ifndef PM_NEWNAMES    // The naming has changed from V2, this should provide
  175.             // backwards compatibility. (disable with #define PM_NEWNAMES)
  176. #define MakeItem    PM_MakeItem
  177. #define MakeMenu    PM_MakeMenu
  178. #define MakeItemA    PM_MakeItemA
  179. #define MakeMenuA    PM_MakeMenuA
  180. #define FreePopupMenu    PM_FreePopupMenu
  181. #define OpenPopupMenu    PM_OpenPopupMenu
  182. #define OpenPopupMenuA    PM_OpenPopupMenuA
  183. #define MakeIDList    PM_MakeIDList
  184. #define MakeIDListA    PM_MakeIDListA
  185. #define ItemChecked    PM_ItemChecked
  186. #endif
  187.  
  188. #define PM_SubMenuTimer        (TAG_USER+1)    // OBSOLETE!
  189. #define PM_RecessSelected    (TAG_USER+2)    // OBSOLETE!
  190. #define PM_WideSelectBar    (TAG_USER+3)    // OBSOLETE!
  191. #define PM_Compact        (TAG_USER+5)    // OBSOLETE!
  192. #define PM_OldLook        (TAG_USER+6)    // OBSOLETE!
  193. #define PM_SameHeight        (TAG_USER+7)    // OBSOLETE!
  194. #define PM_CheckMark        (TAG_USER+8)    // OBSOLETE!
  195. #define PM_ExcludeMark        (TAG_USER+9)    // OBSOLETE!
  196. #define PM_SubMenuMark        (TAG_USER+10)    // OBSOLETE!
  197. #define PM_SmartRefresh        (TAG_USER+11)    // OBSOLETE!
  198.  
  199. #ifndef LIBRARIES_BGUI_H
  200. #define Menu(t)        MakeMenu(PM_Item, MakeItem(PM_Title, t, PM_NoSelect, TRUE, PM_ShinePen, TRUE, TAG_DONE),\
  201.             PM_Item, MakeItem(PM_WideTitleBar, TRUE, TAG_DONE)
  202. #define SubMenu(t)    PM_Sub, MakeMenu(PM_Item, MakeItem(PM_Title, t, PM_NoSelect, TRUE, PM_ShinePen, TRUE, TAG_DONE),\
  203.             PM_Item, MakeItem(PM_WideTitleBar, TRUE, TAG_DONE)
  204. #define Item(t)        PM_Item, MakeItem(PM_Title, t
  205. #define TitleBar    PM_Item, MakeItem(PM_WideTitleBar, TRUE
  206. #define NarrowTitleBar    PM_Item, MakeItem(PM_TitleBar, TRUE
  207. #define MenuTitle(t)    PM_Item, MakeItem(PM_Title, t, PM_NoSelect, TRUE, PM_ShinePen, TRUE, TAG_DONE),\
  208.             PM_Item, MakeItem(PM_WideTitleBar, TRUE, TAG_DONE)
  209. #define Excl        PM_Exclude, MakeIDList(
  210. #define ExID(id)    PM_ExcludeID, id
  211. #define InID(id)    PM_IncludeID, id
  212. #define RefID(id)    PM_ReflectID, id
  213. #define InvID(id)    PM_InverseID, id
  214. #define CheckItem(t,id)    PM_Item, MakeItem(PM_Title, t, PM_ID, id, PM_Checkit, TRUE
  215. #endif    /* LIBRARIES_BGUI_H */
  216.  
  217. #define PMNarrowBar        PM_Item, PM_MakeItem(PM_TitleBar, TRUE
  218. #define PMNarrowTitleBar    PMNarrowBar
  219.  
  220. #endif
  221.